package org.esgl3d.core;

import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;

import android.content.res.AssetManager;
import android.content.res.Resources;

public class AndroidResourceResolver implements ResourceResolver {
	private final static Logger logger = Logger.getLogger(AndroidResourceResolver.class.getName());
	
	private final AssetManager manager;
	
	public AndroidResourceResolver(AssetManager setAssetManager) {
		manager = setAssetManager;
	}
	
	@Override
	public InputStream getResourceStream(String id) {
		InputStream in = null;
		
		if (logger.isLoggable(Level.FINE))
			logger.fine("Trying resource "+id);
		
		try {
			in = manager.open(id);
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return in;
	}

}
